version 17.0
log using "PublishingPublicLaw.log"

******************************************************************************
/*																			*/
/*		Filename: analyze_PublishingPublicLaw.do							*/
/*		Authors: Monica Lineberger, Alyx Mark, and Abigail Matthews	 		*/
/*		Date: July 2025		 								 				*/
/*		Purpose: "Analysis for aticle "Publishing Public Law:				*/
/*					Publication Trends in Law and Courts"					*/
/*																			*/
/****************************************************************************/


ssc install stripplot, replace
ssc install schemepack, replace
set scheme white_tableau

******************************************************************************
use PublishingLaw-author-UoA2025.dta, clear


tab female
tab private
tab female private

**# Median File Overall
eststo sumstats: estpost summarize  nonweightedpubs, d
estpost tabstat nonweightedpubs, statistics(p50 mean sd p25 p75 min max) 

sum nonweightedpubs if female==1, det
sum nonweightedpubs if female==0, det

**#Figure 1: Distribution of Total Number of Publications at Tenure, 1976–2021
stripplot nonweightedpubs, stack ms(O) height(0.25) plotregion(lstyle(none)) xtitle("Publication Count") box(bfcolor(eltblue) blcolor(navy) barw(0.1)) boffset(0.325) iqr  ysca(off)
	graph save "Graph" "graphs/1-noweight.gph", replace
	graph export "graphs/1-noweight.pdf", replace
	graph export "graphs/1-noweight.eps", replace as(eps) name("Graph") preview(on)

	
**# Median Book-based Portfolio
eststo sumstats: estpost summarize books peerArticles lawreviews chapters bigthree if books>0, d 

**# Median Article-based Portfolio
eststo sumstats: estpost summarize peerArticles lawreviews chapters if books<1, d 
estout sumstats, cells(" p50(fmt(1)) mean(fmt(1)) sd(fmt(1))  p25(fmt(1)) p75(fmt(1)) min(fmt(1)) max(fmt(1))") style(fixed) label

sum nonweightedpubs if female==1 & private==1, det


**# Table 1. Book vs. Article-Based Portfolios by Gender and Institution Type
table bookscholar female private


**# Figure 2a. Book-Based Tenure Portfolios
graph box nonweightedpubs if decades==1980 & books>=1, over(female) over(private)  ysc(r(0 30)) ylabel(0(10)30) name(amp1dec80, replace) allc ytitle("Publication Counts") subtitle("1980s")
graph box nonweightedpubs if decades==1990 & books>=1, over(female) over(private)   ysc(r(0 30)) ylabel(0(10)30) name(amp1dec90, replace) ytitle("Publication Counts") subtitle("1990s")
graph box nonweightedpubs if decades==2000 & books>=1, over(female) over(private)  ysc(r(0 30)) ylabel(0(10)30) name(amp1dec00, replace) ytitle("Publication Counts") subtitle("2000s")
graph box nonweightedpubs if decades==2010 & books>=1, over(female) over(private)  ysc(r(0 30)) ylabel(0(10)30) name(amp1dec10, replace) ytitle("Publication Counts") subtitle("2010s")

graph combine amp1dec80 amp1dec90 amp1dec00 amp1dec10, ycommon name(decades_amp1, replace) title("")
graph export "graphs/2agenderprivatedecades-books.pdf", replace
graph export "graphs/2agenderprivatedecades-books.eps", replace as(eps) name("Graph") preview(on)


**# Figure 2b. Article-Based Tenure Portfolios
graph box nonweightedpubs if decades==1980 & books==0, over(female) over(private)  ysc(r(0 30)) ylabel(0(10)30) name(amp0dec80, replace) allc ytitle("Publication Counts") subtitle("1980s")
graph box nonweightedpubs if decades==1990 & books==0, over(female) over(private)   ysc(r(0 30)) ylabel(0(10)30) name(amp0dec90, replace) ytitle("Publication Counts") subtitle("1990s")
graph box nonweightedpubs if decades==2000 & books==0, over(female) over(private)  ysc(r(0 30)) ylabel(0(10)30) name(amp0dec00, replace) ytitle("Publication Counts") subtitle("2000s")
graph box nonweightedpubs if decades==2010 & books==0, over(female) over(private)  ysc(r(0 30)) ylabel(0(10)30) name(amp0dec10, replace) ytitle("Publication Counts") subtitle("2010s")

graph combine amp0dec80 amp0dec90 amp0dec00 amp0dec10, ycommon name(decades_amp0, replace) title("")
graph export "graphs/2bgenderprivatedecades-articles.pdf", replace
graph export "graphs/2bgenderprivatedecades-articles.eps", replace as(eps) name("decades_amp0") preview(on)

 sum nonweightedpubs if private==1, det
 sum nonweightedpubs if private==0, det
 
 ttest nonweightedpubs, by(private) reverse
 
list if bigthreecount>=3 & female==0 & private==1 & decades==2010
list if female==0 & private==1 & decades==2010

sum bigthreecount if private==1, det
sum bigthreecount if private==0, det
 ttest bigthreecount, by(private)
 
*Where else are scholars publishing? 
sum judicialjcount, det
 
bysort decade: sum judicialjcount, d
 
sum generalistjcount, det
sum subfieldjcount, det
sum otherpoliscijcount, det
sum bigthreecount, det

sum propjudicial

sum propgeneralist


list if books<1 & judicialjcount>=1 & subfieldjcount==0 & otherotherjcount==0 & otherpoliscijcount==0 & generalistjcount==0

list if generalistjcount==0 


**# Figure 3: Total Number of Publications in Tenure Portfolios 1976–2021 
  egen total = group(yeartenured nonweightedpubs)
  bysort total: egen count = count(total)

    twoway (lfitci nonweightedpubs yeartenured) ///
	(scatter nonweightedpubs yeartenured [aw = count], mcolor(navy) mlwidth(0) msize(1) legend(off)) ///
    , legend(off) ytitle("Publication Count") xtitle("Year Tenured") graphregion(margin(t=-5)) name(main, replace)
	
	twoway  (histogram yeartenured, yscale(off) xscale(off) fc(gs10) ylabel(, nogrid) xlabel(, nogrid) bin(30)), name(year_hist, replace) graphregion(margin(l=16)) fysize(15)
	
	twoway  (histogram nonweightedpubs, horizontal yscale(off) xscale(off)  fc(gs10) ylabel(, nogrid) xlabel(, nogrid) bin(30)), name(pubs_hist, replace) graphregion(margin(b=15 t=-5)) fxsize(20)
  
  graph  combine year_hist main pubs_hist, hole(2) commonscheme scheme(white_tableau) ///
    title("", size(2.75) pos(11)) subtitle("", size(2.5) pos(11))
	graph save "Graph" "graphs/3pubsovertime.gph", replace
	graph export "graphs/3pubsovertime.pdf", replace
	graph export "graphs/3pubsovertime.eps", replace as(eps) name("Graph") preview(on)

eststo sumstats: estpost summarize med*, d 
estout sumstats, cells(" p50(fmt(1)) mean(fmt(1)) sd(fmt(1))  p25(fmt(1)) p75(fmt(1)) min(fmt(1)) max(fmt(1))") style(fixed) label

sum nonweightedpubs if yearrecent==1, det
sum nonweightedpubs if yearrecent==0, det

ttest nonweightedpubs, by(yearrecent) unequal


**# Table 2: Median Publication Counts by Decade Scholar Was Tenured
eststo sumstats: estpost summarize med* bigthreecount
estout sumstats, cells(" p50(fmt(1)) mean(fmt(1)) sd(fmt(1))  p25(fmt(1)) p75(fmt(1)) min(fmt(1)) max(fmt(1)) N") style(fixed) label

** Big 3 by Gender
sum bigthreecount if female==1, det
sum bigthreecount if female==0, det
ttest bigthreecount, by(female)


* By Private/Public Institutions
sum nonweightedpubs if female==1 & private==1, det
sum nonweightedpubs if female==0 & private==1, det

sum nonweightedpubs if female==1 & private==0, det
sum nonweightedpubs if female==0 & private==0, det
 
ttest nonweightedpubs, by(female)
ttest private, by(female)
 
mvtest means private female bigthreecount


**# Figure 4. Average Scholarly Publication Distribution by Outlet, Gender, and Institution Type Across Decades

set scheme white_ptol

** Figure 4a. By Institution Type
graph bar propgeneralistjcount propjudicialjcount propotherpoliscijcount propsubfieldjcount propotherotherjcount if private==0, over(decades) stack title("Public Institutions") legend(off) name(public, replace)

graph bar propgeneralistjcount propjudicialjcount propotherpoliscijcount propsubfieldjcount propotherotherjcount if private==1, over(decades) asyvars stack title("Private Institutions") legend(position(6) rows(2) label(1 "Generalist Journals") label(2 "Judicial Journals") label(3 "Other Political Science Journals") label(4 "Subfield Journals") label(5 "Other Journals")) name(private, replace) 

	grc1leg public private, ycommon xcommon legendfrom(private)
	graph export "graphs/4pubprivatewherepublish.pdf", replace
	graph export "graphs/4pubprivatewherepublish.eps", replace as(eps) name("Graph") preview(on)

** Figure 4b. By Gender
graph bar propgeneralistjcount propjudicialjcount propotherpoliscijcount propsubfieldjcount propotherotherjcount if female==1 & private==1, over(decades) asyvars stack legend(off) title("Women") name(female, replace)  

graph bar propgeneralistjcount propjudicialjcount propotherpoliscijcount propsubfieldjcount propotherotherjcount if female==0, over(decades) asyvars stack	name(male, replace) legend(position(6) rows(2) label(1 "Generalist Journals") label(2 "Judicial Journals") label(3 "Other Political Science Journals") label(4 "Subfield Journals") label(5 "Other Journals"))  title("Men")
	
	grc1leg female male, ycommon xcommon legendfrom(male) pos(6)
	graph export "graphs/4malefemalewherepublish.pdf", replace
	graph export "graphs/4malefemalewherepublish.eps", replace as(eps) name("Graph") preview(on)


**# Figure 5:  Total Number of Top-Three Publications by Gender and Institution at Tenure 1976–2021.
ttest b3manprivate==b3manpublic
ttest b3womanprivate==b3womanpublic
ttest b3manprivate==b3womanprivate
ttest b3manprivate==b3womanpublic

mvtest means bigthreecount private female
sum bigthreecount if female==1 & private==0, det
sum bigthreecount if female==1 & private==1, det
sum bigthreecount if female==0 & private==0, det
sum bigthreecount if female==0 & private==1, det

set scheme white_tableau

twoway (scatter yeartenured bigthreecount if female==0 & private==0,  msymbol(O) mc(gs11) ylabel(, grid) xlabel(, grid)) ///
(scatter yeartenured bigthreecount if female==0 & private==1,  msymbol(S) mc(gs6) ylabel(, grid) xlabel(, grid)) ///
(scatter yeartenured bigthreecount if female==1 & private==0,  msymbol(T) mc(gs10) ylabel(, grid) xlabel(, grid)) ///
(scatter yeartenured bigthreecount if female==1 & private==1,  msymbol(D) mc(gs8) yscale(range(1976(10)2021)) ytitle("Year Tenured") xscale(range(0(2)12)) xtick(0(2)12) xlab(0(2)12) xtitle("Count of Big Three Publications") legend( pos(6) row(1) order(1 "Men at Public" 2 "Men at Private" 3 "Women at Public" 4 "Women at Private")) name(b2, replace))
graph export "graphs/5big3genderpubpriv.pdf", replace
graph export "graphs/5big3genderpubpriv.eps", replace as(eps) name("b2") preview(on)



**# Figure 6: Ratio of Total Publications That Are Coauthored
twoway (lfitci coauthorratio yeartenured) (scatter coauthorratio yeartenured, mcolor(navy)),  legend(off) ytitle("Ratio of Total Publications That Are Coauthored") xtitle("Year Tenured") 
graph export "graphs/6coauthors.pdf", replace
graph export "graphs/6coauthors.eps", replace as(eps) name("Graph") preview(on)

sum coauthorratio if yearrecent==1, det
sum coauthorratio if yearrecent==0, det

ttest coauthorratio, by(yearrecent)
ttest coauthorratio, by(female)

sum nonweightedpubs if female==1, det
sum nonweightedpubs if female==0, det

ttest nonweightedpubs, by(female)

bysort private: egen medpubspriv = median(nonweightedpubs)
ttest medpubspriv, by(female)
mvtest means private female nonweightedpubs

tab coauthor female, col


**# Figure 7:  Coauthorship Teams by Gender, 1976-2021
use "PublishingLaw-article-UoA2025", clear

twoway ///
	(lfitci allmen pubyear, lpattern(...-)) ///
	(lfitci mixedcoauthor pubyear, lpattern(dash)) ///
	(lfitci allwomen pubyear, legend(order(6 "All Women" 2 "All Men" 4 "Mixed Coauthors") pos(6)cols(3)) xtitle("Publication Year While on Tenure Track"))
	graph save "Graph" "graphs/7coauthorgender.gph", replace
	graph export "graphs/7coauthorgender.pdf", replace
	graph export "graphs/7coauthorgender.eps", replace as(eps) name("Graph") preview(on)


*************************
**# APPENDIX
*************************
use PublishingLaw-author-UoA2025.dta, clear

**# Appendix Table 1. Publication Counts of Successful Tenure Portfolios 1976–2021
eststo sumstats: estpost summarize weightedpubsTT nonweightedpubs pubsfullchap weightedpubspretenure weightedpubsTTpostPhd, d
estpost tabstat weightedpubsTT nonweightedpubs pubsfullchap weightedpubspretenure weightedpubsTTpostPhd, statistics(p50 mean sd p25 p75 min max N) 


**# Appendix Table 2. Median journal article tenure portfolio 1976–2021
eststo sumstats: estpost summarize peerArticles chapters lawreviews bigthree if books<1, d 
estpost tabstat peerArticles chapters lawreviews bigthree if books<1, statistics(p50 mean sd p25 p75 min max N) 


**# Appendix Table 3 Median book tenure portfolio 1976–2021
eststo sumstats: estpost summarize books peerArticles chapters lawreviews bigthree if books>0, d 
estpost tabstat books peerArticles chapters lawreviews bigthree if books>0, statistics(p50 mean sd p25 p75 min max N) 


**# Appendix Table 4. Publication Counts of Successful Tenure Portfolios 1976–2021 if Book Manuscript Equals Four Peer-Reviewed Articles
eststo sumstats: estpost summarize weightedpubsTT4  nonweightedpubs pubsfullchap4 weightedpubs4pretenure weightedpubs4postPhd, d
estpost tabstat weightedpubsTT4 nonweightedpubs4 pubsfullchap4 weightedpubs4pretenure weightedpubs4postPhd, statistics(p50 mean sd p25 p75 min max N) 


**# Appendix Table 5. Median tenure portfolio 1976–2006 & 2007-2021
eststo sumstats: estpost summarize weightedpubsTT nonweightedpubs pubsfullchap weightedpubspretenure bigthreecount if yeartenured<2007, d
estpost tabstat weightedpubsTT nonweightedpubs pubsfullchap weightedpubspretenure bigthreecount if yeartenured<2007, statistics(p50 mean sd p25 p75 min max N) 

eststo sumstats: estpost summarize weightedpubsTT nonweightedpubs pubsfullchap weightedpubspretenure bigthreecount if yeartenured>=2007, d
estpost tabstat weightedpubsTT nonweightedpubs pubsfullchap weightedpubspretenure bigthreecount if yeartenured>=2007, statistics(p50 mean sd p25 p75 min max N) 


**# Appendix Table 6. Median tenure portfolio 1976–2006 & 2007-2021 if Book Manuscript Equals Four Peer-Reviewed Articles
eststo sumstats: estpost summarize weightedpubsTT4 nonweightedpubs4 pubsfullchap4 weightedpubs4pretenure if yeartenured<2007, d
estpost tabstat weightedpubsTT4 nonweightedpubs4 pubsfullchap4 weightedpubs4pretenure if yeartenured<2007, statistics(p50 mean sd p25 p75 min max N) 

eststo sumstats: estpost summarize weightedpubsTT4 nonweightedpubs4 pubsfullchap4 weightedpubs4pretenure  if yeartenured>=2007, d
estpost tabstat weightedpubsTT4 nonweightedpubs4 pubsfullchap4 weightedpubs4pretenure if yeartenured>=2007, statistics(p50 mean sd p25 p75 min max N) 


**# Appendix Table 7. Tenure Portfolio Publication Counts 1976–2021 by Number of Years It Took Scholar to Earn Tenure
gen yearstotenure = yeartenured - yearphd
asdoc tab yearstotenure nonweightedpubs , label font(Times New Roman) fs(12) save(A7yearstotenure.doc) title(\i)


**# Appendix Figure 1: Publication Count by Time-To-Tenure 1976–2021.

twoway  ///
	(scatter nonweightedpubs yearstotenure, msymbol(O) mcolor(gs8) mlwidth(0) msize(1) legend(off)) ///
    (lfit  nonweightedpubs yearstotenure, lc(navy) lp(solid) ytitle("Publication Count") xtitle("Years to Tenure") graphregion(margin(t=-5)) name(main7, replace))
	
  twoway  ///
  (histogram yearstotenure, freq yscale(off) fc(gs10) xscale(off) ylabel(, nogrid) xlabel(, nogrid) bin(30) legend(off) ), graphregion(margin(l=16)) fysize(15) name(years_private_hist, replace)
   
  twoway /// 
  (histogram yearstotenure if private==0, horizontal yscale(off) fc(gs10) xscale(off) ylabel(, nogrid) xlabel(, nogrid) bin(30) legend(off)), name(pub_private_hist, replace) graphregion(margin(b=15 t=-5)) fxsize(20)
  
graph  combine years_private_hist main7 pub_private_hist, hole(2) commonscheme scheme(white_tableau) ///
    title("", size(2.75) pos(11)) subtitle("", size(2.5) pos(11))
	graph save "Graph" "graphs/A1yearstotenurePubs.gph", replace
	graph export "graphs/A1yearstotenurePubs.pdf", replace


**# Appendix Figure 2 Publication Record by Gender and Institution, 1976–2021.
stripplot nonweightedpubs, over(female) by(private, compact note("") row(1)) stack ms(O) height(0.25) plotregion(lstyle(none)) xtitle("") ytitle("Publication Count") box(bfcolor(eltblue) blcolor(navy) barw(0.1)) boffset(0.325) iqr ysca(off) vertical name(A2institutiongender, replace)
 graph export "graphs/A2institutiongender.pdf", replace

 
log close
